import * as tools from "./backgroundUtil";
import {b as browser} from "./browser-polyfill";

const a ="11"
browser.runtime.onMessage.addListener((message, sender, sendResponse) => {

  const msg = JSON.parse(message);

  tools[msg.key](msg.params).then(res => {
    sendResponse(JSON.stringify(res));
  }).catch((err: Error) => {
    const errMsg = {code: '10001', msg: err.message}
    sendResponse(JSON.stringify(errMsg))
  })
  return true;
})